﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
using ControlStock.Servicio;
using ControlStock.Dominio;

namespace ControlStock
{
    public partial class Articulostock : System.Web.UI.Page
    {
        ArticuloServicio servicioArticulos;
        List<Depositos> lista;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["id_Usuario"] == null)
                Response.Redirect("index.aspx");
            if (Session["Tipo_Usuario"] == "Administrador")
                btnprincipal.Visible = true;

            if (!Page.IsPostBack)
            {
                if (servicioArticulos == null)
                {
                    servicioArticulos = new ArticuloServicio();
                }
                List<Articulos> ListaArticulos = servicioArticulos.Listar(Convert.ToString(Session["Tipo_Usuario"]));
                ddlarticulostock.DataSource = ListaArticulos;
                ddlarticulostock.DataValueField = "Id_Art";
                ddlarticulostock.DataTextField = "Descripcion_Art";
                ddlarticulostock.DataBind();
            }
        }

        protected void btnseleccionar_Click(object sender, EventArgs e)
        {
            if (servicioArticulos == null)
            {
                servicioArticulos = new ArticuloServicio();
            }
            GvArticulos.DataSource = servicioArticulos.Listar(ddlarticulostock.SelectedItem.Text.ToString(), Convert.ToString(Session["Tipo_Usuario"]));
            GvArticulos.DataBind();
        }

       
        protected void btnprincipal_Click(object sender, EventArgs e)
        {
            Response.Redirect("Principal.aspx");
        }
    }
}
